﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 抽象工厂
{
    class Program
    {
        static void Main(string[] args)
        {
            Driver d = new BenzDriver();
            BusinessCar bbc = d.SelectBC();
            bbc.Run();
        }
    }
    interface BusinessCar
    {
        void Run();
    }
    interface SportCar
    {
        void Run();
    }
    class BMWBusinessCar : BusinessCar
    {
        public void Run()
        {
            Console.WriteLine("宝马商务车跑");
        }
    }
    class BMWSportCar : SportCar
    {
        public void Run()
        {
            Console.WriteLine("宝马跑车跑");
        }
    }
    class BenzBusinessCar:BusinessCar
    {
        public void Run()
        {
            Console.WriteLine("奔驰商务跑");
        }
    }
    class BenzSportCar : SportCar
    {
        public void Run()
        {
            Console.WriteLine("奔驰跑车跑");
        }
    }
    interface Driver
    {
        BusinessCar SelectBC();

        SportCar SelectSC();
    }
    class BMWDriver : Driver
    {
        public BusinessCar SelectBC()
        {
            return new BMWBusinessCar();
        }

        public SportCar SelectSC()
        {
            return new BMWSportCar();
        }
    }
    class BenzDriver : Driver
    {
        public BusinessCar SelectBC()
        {
            return new BenzBusinessCar();
        }

        public SportCar SelectSC()
        {
            return new BenzSportCar();
        }
    }
}
